<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // filter 过滤
        const arr=[20,30,40,50,60]
        // let newarr= arr.filter(function(item,index){
        //     return item>=40
        // console.log(item);//元素
        // console.log(index);//索引
        // })
        // 箭头函数，只有一句可以写在一行  
        let newarr=arr.filter((item,index)  =>  item>=40)
        console.log(newarr);
    </script>
</body>
</html>